package Demo3;
class Money implements Cloneable{
    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }

    public double money=9.9;
}
public class Person implements Cloneable {
    public int age;
    public String name;
    public Money m=new Money();
    public Person(String name,int age){
        this.name=name;
        this.age=age;
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
//        return super.clone();
        Person temp=(Person)super.clone();
        temp.m=(Money)this.m.clone();
        return temp;
    }
}
